package com.qf.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qf.pojo.Student;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface StudentMapper extends BaseMapper<StudentMapper> {

    //对id通过mod函数取余进行分片
    @Select("SELECT * FROM `student` WHERE MOD(id,#{shardingTotalCount})=#{shardingItem}")
    List<Student> queryStuById(@Param("shardingTotalCount") int count,
                                @Param("shardingItem") int item);

}
